﻿
@{
    ViewData["Title"] = "View";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@section Head{
<link rel="stylesheet" href="../../layuiadmin/style/Category/index.css" />
<link rel="stylesheet" href="../../layuiadmin/style/Category/dtree.css" />
<link rel="stylesheet" href="../../layuiadmin/layui/font/dtreefont.css" />
}

<div class="left-ss Category container">
    <div class="layui-btn-group layui-btn-group-sjd" id="btnbar">
        <!-- <button type="button" class="layui-btn layui-btn-sm layui-btn-primary"  dtree-id="sxdh" dtree-menu="add">
        <i class="layui-icon">&#xe654;</i>
         </button>
         <button type="button" class="layui-btn layui-btn-sm layui-btn-primary" dtree-id="sxdh" dtree-menu="edit">
            <i class="layui-icon">&#xe640;</i>
         </button>
         <button type="button" class="layui-btn layui-btn-sm layui-btn-primary" dtree-id="sxdh" dtree-menu="delete">
                            <i class="layui-icon">&#xe640;</i>
         </button> -->
    </div>

    <div id="sxdh" class="layui-box"></div>
</div>

<div class="center-ss">
</div>


<!-- 主体内容 -->
<div class="right-ss">
    <div class="layui-tab layui-tab-card layuitab-content" lay-filter="demo">
        <ul class="layui-tab-title">
            <li class="layui-this">基本信息管理</li>
            <li class="">门类字段管理</li>
            <li class="">著录界面设置</li>
            <li class="">著录界面预览</li>
            <li class="">浏览界面设置</li>
        </ul>
        <div class="layui-tab-content">
            <div class="layui-tab-item layui-show layui-tab-item1">
                <partial name="Base" />
            </div>
        </div>
        <div class="layui-tab-item  layui-tab-item2">          
            <partial name="Field" />
        </div>
        <div class="layui-tab-item layui-tab-item3">
            @await Html.PartialAsync("Form")
        </div>
        <div class="layui-tab-item layui-tab-item5">
            @await Html.PartialAsync("Preview")

        </div>
        <div class="layui-tab-item  layui-tab-item4">
            @await Html.PartialAsync("List")
        </div>
    </div>
</div>

@section scripts{
    <script src="../../layuiadmin/layui/layui.js"></script>
    <script>
        layui.config({
            base: "/layuiadmin/"
        }).extend({
            index: 'lib/index'
        })
            .use(['tree', 'jquery', 'table', 'code', 'layer', 'index', 'dtree'], function () {
                var tree = layui.tree, $ = layui.jquery, table = layui.table, code = layui.code, layer = layui.layer, index = layui.index, dtree = layui.dtree;

                $(function () {
                    var left = $('.left-ss');
                    var center = $('.center-ss');
                    var right = $('.right-ss');
                    dragBox(left, center, right);
                    function dragBox(left, center, right) {
                        center.off('mousedown').on("mousedown", function (e) {
                            e = e || window.event;
                            e.preventDefault();
                            var me = left, x = e.clientX - me.width();
                            $(document).on("mousemove", mouseMove).on("mouseup", mouseUp);
                            //移动事件
                            function mouseMove(e) {
                                e = e || window.event;
                                left.css('width', e.clientX - x);
                                right.css('margin-left', e.clientX - x + 15);
                            }
                            //停止事件
                            function mouseUp() {
                                //卸载事件
                                $(document).off("mousemove", mouseMove).off("mouseup", mouseUp);
                            }
                        });
                    }

                })
                var jsonData = [{
                    title: '档案', spread: true, children: [{ title: '诉讼档案', }, {
                        title: '文书档案', children: [{
                            title: '简化文书'
                        }, {
                            title: '诉讼档案'
                        }]
                    }, {
                        title: '科技档案'
                    }, {
                        title: '基建档案'
                    }]
                }]
                // 树代码示例
                var DTree1 = dtree.render({
                    elem: "#sxdh",
                    data: jsonData,
                    useIframe: true,  //启用iframe
                    iframeElem: "#iframecate",  // iframe的ID
                    iframeUrl: "Categorya.html", // iframe路由到的地址
                    initLevel: "1",
                    ficon: ["1", "-1"],
                    leafIconArray: { "11": "dtree-icon-star" },

                    toolbar: true, // 开启工具栏
                    toolbarShow: ["add", "delete"],// 工具栏自带的按钮制空
                    toolbarFun: {
                        addTreeNode: function (treeNode, $div) { //添加树节点后调用的函数，用于用户自定义，如未指定则树不会发生变化
                            //console.log(treeNode);
                            // DTree1.changeTreeNodeAdd(treeNode.nodeId/param/true/false/"refresh"); // 调用内置函数，新增节点后改变节点内容。传入null或false，则树不会发生变化
                            DTree1.changeTreeNodeAdd(treeNode.nodeId);
                        },
                        delTreeNode: function (treeNode, $div) { //删除树后调用的函数，用于用户自定义，如未指定则树不会发生变化
                            console.log(treeNode);
                            DTree1.changeTreeNodeDel(true / false); // 调用内置函数，删除节点后改变节点内容。传入false，则树不会发生变化
                        },
                        loadToolbarBefore: function (buttons, treeNode, $div) { // 右键菜单加载前的函数

                            return buttons; // 返回按钮组，如不返回则按钮将不会显示。
                        }
                    }
                });


                var getUrlParam = function (name) {
                    var url = location.search;
                    url = url.substring(url.indexOf("?"));
                    if (url.indexOf("?") != -1) {
                        var str = url.substr(1);
                        strs = str.split("&");
                        for (var i = 0; i < strs.length; i++) {
                            if (name == strs[i].split("=")[0]) {
                                return unescape(strs[i].split("=")[1]);
                            }
                        }
                    }
                    return "";
                }
            })
    </script>

}